Skip to content

Conversation

@chris-olszewski
Copy link
Member

@chris-olszewski chris-olszewski commented Oct 2, 2025

What was changed

Added ability to send binary gRPC headers via NativeConnection.

Also added a test to verify that binary headers were accepted by Connection.

Why?

Make progress on temporalio/features#671

Checklist

  1. Closes [Feature Request] Ensure gRPC binary metadata headers are supported #1778

  2. How was this tested:
    Added setting and sending of binary headers at both the client and call level for both native and the standard client connection.

  3. Any docs updates needed?
    I believe the type expansion from string to string | Buffer is the only user facing change and that change should appear in the API reference.

Each commit is reviewable on its own.

@chris-olszewski chris-olszewski force-pushed the olszewski/feat_grpc_bin_headers branch from fa18a14 to 2235a4f Compare October 3, 2025 13:25
let Some(headers) = headers else {
return (None, None);
};
let mut ascii_headers = HashMap::default();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible optimization is to create the hashmap with the same capacity as the initial headers map. Only downside I could see would be if the headers were mostly binary.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is once per native client + on clientUpdateHeader. Neither of them should be called frequently enough to justify efforts on performance optimization IMO.

But if we'd indeed want to go there, I'd initiate both hashmaps at the capacity of the initial headers map, up to a certain upper limit (something like 128 or 256). That should optimize performance in all cases while providing a reasonable upper limit on how much memory we may allocate uselessly.

But honestly, I wouldn't mind that one.

@chris-olszewski chris-olszewski force-pushed the olszewski/feat_grpc_bin_headers branch from 1b17bc4 to def0d6c Compare October 3, 2025 14:45
@chris-olszewski chris-olszewski force-pushed the olszewski/feat_grpc_bin_headers branch from def0d6c to b9ec854 Compare October 3, 2025 14:55
@chris-olszewski chris-olszewski marked this pull request as ready for review October 3, 2025 15:17
@chris-olszewski chris-olszewski requested a review from a team as a code owner October 3, 2025 15:17
Copy link
Contributor

@mjameswh mjameswh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks!

@mjameswh mjameswh merged commit 4a99cee into main Oct 15, 2025
72 of 77 checks passed
@mjameswh mjameswh deleted the olszewski/feat_grpc_bin_headers branch October 15, 2025 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Ensure gRPC binary metadata headers are supported

2 participants